//
//  ViewControllerA.m
//  传值-Xib
//
//  Created by student on 16/2/25.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "ViewControllerA.h"
#import "ViewControllerB.h"
#import "ViewControllerC.h"
@interface ViewControllerA ()<ViewControllerCDelegate>
@property (weak, nonatomic) IBOutlet UITextField *usernameTextField;
@property (weak, nonatomic) IBOutlet UITextField *passwordTextField;
- (IBAction)loginBtnPressed:(id)sender;

- (IBAction)reginBtnPressed:(id)sender;

@property (weak, nonatomic) IBOutlet UILabel *reginInfoLabel;


@end

@implementation ViewControllerA

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)loginBtnPressed:(id)sender {
    ViewControllerB *vcB=[[ViewControllerB alloc]init];
    vcB.modalPresentationStyle=UIModalPresentationFullScreen;
    vcB.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
    vcB.username = self.usernameTextField.text;
    vcB.password = self.passwordTextField.text;

    
    [self presentViewController:vcB animated:YES completion:nil];
}

- (IBAction)reginBtnPressed:(id)sender {
    ViewControllerC *vcC=[[ViewControllerC alloc]init];
    vcC.delegate = self;
    vcC.modalPresentationStyle=UIModalPresentationOverFullScreen;
    vcC.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
    [self presentViewController:vcC animated:YES completion:nil];
}
- (void)transUserName:(NSString *)u andPassword:(NSString *)p andEmail:(NSString *)e
{
    NSLog(@"A:得到C传来的数据:%@,%@,%@",u,p,e);
    self.reginInfoLabel.text = [NSString stringWithFormat:@"注册成功!%@，%@,%@",u,p,e];
}
@end
